home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / prodpack.zip / DB4PPSRC.EXE / _CATOPEN.PRG < prev    next >
Text File  |  1993-05-04  |  2KB  |  66 lines

  1. PROCEDURE _CatOpen
  2. PARAMETER pl_ok
  3. *---------------------------------------------------------------------
  4. * NAME
  5. *   _CatOpen - open the current catalog file
  6. *
  7. * DESCRIPTION
  8. *   _CatOpen opens the current catalog with an ALIAS of FXCatalog.
  9. *   If _CatOpen cannot open the catalog, it will return a .F.
  10. *   Otherwise it will return .T.
  11. *
  12. * SYNOPSIS
  13. *   DO _CatOpen WITH <pl_ok>
  14. *
  15. * PARAMETERS
  16. *   pl_ok   = return .T. if opened, .F. if not
  17. *
  18. * EXAMPLE
  19. *   lc_cat = SET( "CATALOG" )           && Save the catalog state
  20. *   SET CATALOG OFF                     && Force the catalog off
  21. *   isok = .F.                          && Assume no catalog available
  22. *   DO _CatOpen WITH isok               && Try and open the catalog
  23. *   SELECT FXCatalog                    && Select the FXCatalog work area
  24. *   ...                                 && Catalog manipulation code here
  25. *   DO _CatClose                        && Close the catalog
  26. *   IF lc_cat = "ON"                    && If the catalog was on before
  27. *     SET CATALOG OFF                   && Turn the catalog back on
  28. *   ENDIF
  29. *
  30. * LIMITATIONS
  31. *   CATALOG must be OFF, otherwise the catalog name will end up
  32. *   in the catalog file.
  33. *
  34. * DEPENDENCIES
  35. *   Calls:  _CatCurr - Get the current catalog
  36. *
  37. * VARIABLES
  38. *   lc_catname  = Name of the catalog file to open.  Value set by
  39. *                 _CatCurr.
  40. *
  41. *---------------------------------------------------------------------
  42.   PRIVATE lc_catname
  43.  
  44.   pl_ok = .F.                           && Assume it does not work
  45.   lc_catname = ""                       && Assume it does not work
  46.  
  47.   DO _CatCurr WITH lc_catname           && Get the current catalog name
  48.  
  49.   IF .NOT. ISBLANK( lc_catname )        && Did it find a catalog?
  50.  
  51.     ON ERROR DO _F_Error
  52.     *-- Open the current catalog file
  53.     USE ( lc_catname ) AGAIN ALIAS FXCatalog IN SELECT() NOLOG
  54.  
  55.     IF TYPE( "FXL_Error" ) <> "L"
  56.       pl_ok = .T.                       && Set the result to success
  57.     ELSE
  58.       RELEASE FXL_Error
  59.     ENDIF
  60.  
  61.   ENDIF
  62.  
  63. RETURN
  64. *-- EOP: _CatOpen WITH pl_ok
  65.  
  66.